package com.itheima.demo;

/*
import com.itheima.domain.Teacher;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;

public class ComparatorDemo01 {
    */
/*public static void main(String[] args) {
        //创建一个比较器对象用于给TreeSet指定排序规则.
        Teacher[] teachers = new Teacher[6];
        teachers[0] = new Teacher("张三", 20, 100, 100);
        teachers[1] = new Teacher("李四", 21, 100, 100);
        teachers[2] = new Teacher("田五", 23, 99, 100);
        teachers[3] = new Teacher("刘六", 19, 100, 99);
        teachers[4] = new Teacher("张七", 23, 80, 88);
        teachers[5] = new Teacher("宋八", 22, 90, 78);

        //给数组中的Teacher进行排序 -> 比较器也可以用于其他地方的排序规则的对比.
        Arrays.sort(teachers, new Comparator<Teacher>() {
            @Override
            public int compare(Teacher o1, Teacher o2) {
                return 0;
            }
        });

        ArrayList<Teacher> teachers2 = new ArrayList<>();

        teachers2.add(new Teacher("张三",20,100,100));
        teachers2.add(new Teacher("李四",21,100,100));
        teachers2.add(new Teacher("田五",23,99,100));
        teachers2.add(new Teacher("刘六",19,100,99));
        teachers2.add(new Teacher("张七",23,80,88));
        teachers2.add(new Teacher("宋八",22,90,78));

        //Collections
        Collections.sort(teachers2, new Comparator<Teacher>() {
            @Override
            public int compare(Teacher o1, Teacher o2) {
                return 0;
            }
        });

    }*//*

}*/
